<?php
class Food{
    public $id;
    public $name;
    public $description;
    public $location;
    public $food_type_id;
    public $_table = 'food';
    public $_primarykey = 'id';
    public $_fields = array('id','name','description','location','food_type_id');

    public function get_recipe(){
        return Doo::db()->relate('Recipe', __CLASS__, array('limit'=>'first'));
    }

    public function get_by_id(){
        if(intval($this->id)<=0)
            return null;
        return Doo::db()->find($this, array('limit'=>1));
    }
}
?>